{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'Hello, Tensors!'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "hello = tf.constant('Hello, Tensors!')\n",
    "sess = tf.Session()\n",
    "sess.run(hello)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "42"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Mathematical computation\n",
    "a = tf.constant(10)\n",
    "b = tf.constant(32)\n",
    "sess.run(a+b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[  97.90089253   49.65639571  132.06976521  117.15901426   64.24402485\n",
      "    42.71392363]\n",
      " [ 129.76906475   90.42108309  151.10599956  171.28073698   85.56643083\n",
      "    42.14081188]\n",
      " [  68.40553802   53.77074288   79.40627517   84.2220267    45.15710792\n",
      "    23.42022876]]\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "\n",
    "mat_1 = 10*np.random.random_sample((3, 4))\t\t# Creating NumPy arrays\n",
    "mat_2 = 10*np.random.random_sample((4, 6))\n",
    "\n",
    "# Creating a pair of constant ops, and including the above made matrices\n",
    "tf_mat_1 = tf.constant(mat_1)\n",
    "tf_mat_2 = tf.constant(mat_2)\n",
    "\n",
    "# Multiplying TensorFlow matrices with matrix multiplication operation\n",
    "tf_mat_prod = tf.matmul(tf_mat_1 , tf_mat_2)\n",
    "\n",
    "sess = tf.Session()\t\t\t\t\t# Launching a session\n",
    "\n",
    "# run() executes required ops and performs the request to store output in ‘mult_matrix’ variable\n",
    "mult_matrix = sess.run(tf_mat_prod)\n",
    "print(mult_matrix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Addition of constants 10 and 20 is 52 \n",
      "Subtraction of constants 10 and 20 is -12 \n"
     ]
    }
   ],
   "source": [
    "# Performing constant operations with the addition and subtraction of two constants\n",
    "a = tf.constant(10)\n",
    "a = tf.constant(20)\n",
    "\n",
    "print(\"Addition of constants 10 and 20 is %i \" % sess.run(a+b) )\n",
    "print(\"Subtraction of constants 10 and 20 is %i \" % sess.run(a-b))\n",
    "\n",
    "sess.close()\t\t\t\t\t\t# Closing the session"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
